package com.yibo.manager.user.service.manager;

import com.yibo.support.inter.Command;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

/**
 * 退出命令
 */
public class LoginOutCommand implements Command<Integer> {


    @Override
    public Integer execute() {
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();

        String sessionId = request.getHeader("token");
        System.clearProperty(sessionId);
        return 1;
    }
}
